import mongoose from "mongoose";
import { encrypt } from "../utils/bcryptjs";
const bemRuler = new mongoose.Schema({
  phone: { type: Number, require: true, unique: true },
  username: {
    type: String,
    default: Math.random().toString(36).substring(2) + Date.now(),
  },
  role: { type: String, default: "普通用户" },
  btnrole:{type:Array,default:[]},
  avator: { type: String, default: "/upload/bb11be7cec69344e80cde3201.jpg" },
  password: {
    type: String,
    require: true,
    set(val: string) {
      return encrypt(val);
    },
  },
});
const bemModel = mongoose.model("bemModel", bemRuler);
export default bemModel;
